\hypertarget{classcantor_1_1_cantor}{\section{cantor.\-Cantor Class Reference}
\label{classcantor_1_1_cantor}\index{cantor.\-Cantor@{cantor.\-Cantor}}
}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
def \hyperlink{classcantor_1_1_cantor_af054a78301a4cc06e172a7ed442381e7}{pair}
\begin{DoxyCompactList}\small\item\em Returns the \hyperlink{classcantor_1_1_cantor}{Cantor} pair of the two numbers k1, and k2. \end{DoxyCompactList}\item 
def \hyperlink{classcantor_1_1_cantor_a593ba595efb55ddc0b6d9b03e8165e3a}{inv}
\begin{DoxyCompactList}\small\item\em Separates a \hyperlink{classcantor_1_1_cantor}{Cantor} pair into two values k1, and k2. \end{DoxyCompactList}\item 
def \hyperlink{classcantor_1_1_cantor_adade70fac229147d138822b928282df3}{pair\-N}
\item 
def \hyperlink{classcantor_1_1_cantor_a357306f2bcee9ea4cb65e9546a7d3305}{inv\-N}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{classcantor_1_1_cantor}{Cantor} pairing function is a pairing function. \href{http://en.wikipedia.org/wiki/Cantor_pairing_function}{\tt http\-://en.\-wikipedia.\-org/wiki/\-Cantor\-\_\-pairing\-\_\-function} 

\subsection{Member Function Documentation}
\hypertarget{classcantor_1_1_cantor_a593ba595efb55ddc0b6d9b03e8165e3a}{\index{cantor\-::\-Cantor@{cantor\-::\-Cantor}!inv@{inv}}
\index{inv@{inv}!cantor::Cantor@{cantor\-::\-Cantor}}
\subsubsection[{inv}]{\setlength{\rightskip}{0pt plus 5cm}def cantor.\-Cantor.\-inv (
\begin{DoxyParamCaption}
\item[{}]{z}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{classcantor_1_1_cantor_a593ba595efb55ddc0b6d9b03e8165e3a}


Separates a \hyperlink{classcantor_1_1_cantor}{Cantor} pair into two values k1, and k2. 

Inverting the \hyperlink{classcantor_1_1_cantor}{Cantor} Pairing function requires the following 4 steps\-: \par

\begin{DoxyEnumerate}
\item $ w = \lfloor \frac{\sqrt{8z + 1} - 1}{2} \rfloor $ \par

\item $ t = \frac{w^{2} + w}{2} $ \par

\item $ y = z - t $ \par

\item $ x = w - y $ \begin{DoxyPrecond}{Precondition}
none 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
none 
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em z} & A number assumed to be a \hyperlink{classcantor_1_1_cantor}{Cantor} pair. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Tuple of two numbers (k1, k2) that when \hyperlink{classcantor_1_1_cantor}{Cantor} paired produce the input parameter. 
\end{DoxyReturn}

\end{DoxyEnumerate}\hypertarget{classcantor_1_1_cantor_a357306f2bcee9ea4cb65e9546a7d3305}{\index{cantor\-::\-Cantor@{cantor\-::\-Cantor}!inv\-N@{inv\-N}}
\index{inv\-N@{inv\-N}!cantor::Cantor@{cantor\-::\-Cantor}}
\subsubsection[{inv\-N}]{\setlength{\rightskip}{0pt plus 5cm}def cantor.\-Cantor.\-inv\-N (
\begin{DoxyParamCaption}
\item[{}]{ps, }
\item[{}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{classcantor_1_1_cantor_a357306f2bcee9ea4cb65e9546a7d3305}
Separates a set of \hyperlink{classcantor_1_1_cantor}{Cantor} pairs into a set of elements. \begin{DoxyPrecond}{Precondition}
none 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
none 
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em ps} & A single number representing multiple \hyperlink{classcantor_1_1_cantor}{Cantor} pairs. \\
\hline
{\em n} & The number of pairs that ps is made of, and therefore should be split into. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A set of numbers representing the original set of numbers. 
\end{DoxyReturn}
\hypertarget{classcantor_1_1_cantor_af054a78301a4cc06e172a7ed442381e7}{\index{cantor\-::\-Cantor@{cantor\-::\-Cantor}!pair@{pair}}
\index{pair@{pair}!cantor::Cantor@{cantor\-::\-Cantor}}
\subsubsection[{pair}]{\setlength{\rightskip}{0pt plus 5cm}def cantor.\-Cantor.\-pair (
\begin{DoxyParamCaption}
\item[{}]{k1, }
\item[{}]{k2}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{classcantor_1_1_cantor_af054a78301a4cc06e172a7ed442381e7}


Returns the \hyperlink{classcantor_1_1_cantor}{Cantor} pair of the two numbers k1, and k2. 

The \hyperlink{classcantor_1_1_cantor}{Cantor} Pairing function is defined as\-: \par
 $ \pi(k_{1}, k_{2}) := \frac{1}{2}(k_{1} + k_{2})(k_{1} + k_{2} + 1) + k_{2} $ \begin{DoxyPrecond}{Precondition}
none 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
none 
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & A number in the range 0 to X. \\
\hline
{\em k2} & A number in the range 0 to Y. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The \hyperlink{classcantor_1_1_cantor}{Cantor} pairing of k1 and k2. 
\end{DoxyReturn}
\hypertarget{classcantor_1_1_cantor_adade70fac229147d138822b928282df3}{\index{cantor\-::\-Cantor@{cantor\-::\-Cantor}!pair\-N@{pair\-N}}
\index{pair\-N@{pair\-N}!cantor::Cantor@{cantor\-::\-Cantor}}
\subsubsection[{pair\-N}]{\setlength{\rightskip}{0pt plus 5cm}def cantor.\-Cantor.\-pair\-N (
\begin{DoxyParamCaption}
\item[{}]{set}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{classcantor_1_1_cantor_adade70fac229147d138822b928282df3}
Performs the \hyperlink{classcantor_1_1_cantor}{Cantor} pairing function over a set of elements. \begin{DoxyPrecond}{Precondition}
none 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
none 
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em set} & A list of elements to pair into a single number. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A number representing the paired numbers. 
\end{DoxyReturn}


The documentation for this class was generated from the following file\-:\begin{DoxyCompactItemize}
\item 
rlblackjack/\hyperlink{cantor_8py}{cantor.\-py}\end{DoxyCompactItemize}
